<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $this->webname;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<meta name="Keywords" content="" />
<meta name="Description" content="" />
<link rel="stylesheet" href="/statics/css/table.css" type="text/css" />
<script src="/statics/js/jquery.min.js"></script>
<script src="/statics/js/jquery.form.js"></script>
<script src="/statics/js/zhuayi.js"></script>
<script>
$(function(){
	$("#myforms").submit(function(){
		$("#submit").val('请稍后');
		ajax($("#myforms"),api_del);
		return false;
	})
})
</script>
</head>
<body>
<form name="myform" action="/api/del/" method="post" id="myforms">
<div class="table-list">
	<table width="100%" cellspacing="0" >
		<thead>
			<tr>
				<th width="30"><input type="checkbox" name="checkbox" class="check" onClick="javascript:$('input[type=checkbox]').attr('checked',$(this).attr('checked'))"/></th>
				<th>序号</th>
				<th>图标</th>
				<th>接口名</th>
				<th>接口标识</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<?php foreach ($list as $val){?>
			<tr id="<?php echo $val['id'];?>">
				<td><input type="checkbox" value="<?php echo $val['id'];?>" name="id[]" class="check" /></td>
				<td><?php echo $val['id'];?></td>
				<td><img src="<?php echo $val['litpic'].'?rand='.rand();?>" height="32"/></td>
				<td><?php echo $val['title'];?></td>
				<td><?php echo $val['api'];?></td>
				<td>
					<a href="/api/edit/<?php echo $val['id'];?>" class="thickbox">修改</a> |
					<a href="/api/del/" onclick="return ajax_del(this,'<?php echo $val['id'];?>')">删除</a>
				</td>
			</tr>
		<?php }?>
		</tbody>
	</table>
	<div class="btn">
		<div style="float:left">
			<input type="button" class="button" name="dosubmit" value="添加" onclick="tb_show('添加接口','/api/add/')"/>
			<input type="submit" class="button" id="submit" value="删除选中"/>
		</div>
		<div class="page"><?php echo $page->show();?></div>
	</div>
</div>
</form>
</body>
<script>setTimeout('tb_table("table-list")',300)</script>
<script>
function ajax_del(obj,ids)
{
	
	$.post($(obj).attr('href'),{id:ids},function(data)
	{
		//alert(data);
		var data=eval("("+data+")");
		if (data['code_en'] == '-1')
		{
			alert(data['code_cn']);
			return false;
		}
		
		$("#"+ids).remove();
	})
	return false;
}

function api_del(data)
{

	var data=eval("("+data+")");
	if (data['code_en'] == '-1')
	{
		alert(data['code_cn']);
		return false;
	}
	tb_show('','/api/');
}
</script>